﻿//////////////////////////////////////////////////////////////////////////////
//
//  Copyright © 1998-2024 Glodon Company Limited.  All rights reserved.
//
//  Use of this software is subject to the terms of the Glodon license
//  agreement provided at the time of installation or download, or which
//  otherwise accompanies this software in either electronic or hard copy form.  
//
//////////////////////////////////////////////////////////////////////////////


#pragma once

#include "GmModelFamily.h"
#include "GcmpBuiltInCategoryUniIdentities.h"

namespace gcmp
{
    class IDocument;
    class UniIdentity;
}

namespace gfam
{ 
    class IFamilyDatabase;


    /// \brief 创建族文档
    class GCMP_MODEL_FAMILY_EXPORT FamilyDocumentUtility
    {
    public:
        /// \brief 创建族文档
        /// 
        /// \param familyCategoryUid Category的UniIdentity
        /// \param candidateName 文档名称
        /// \return 新创建的族文档
        static gcmp::IDocument* CreateFamilyDocument(const gcmp::UniIdentity& familyCategoryUid = gcmp::BuiltInCategoryUniIdentities::BICU_POINT_FAMILY,
            const std::wstring& candidateName = L"");

        /// \brief 读取构件文件的版本信息
        /// 
        /// \param filePathName 构件文件路径
        /// \return 若成功，返回版本字符串；若失败，返回空字符串
        static std::wstring GetFamilyFileVersion(const std::wstring &filePathName);

        /// \brief 写入构件文件的版本信息
        /// 
        /// \param filePathName 构件文件路径，文件需要已存在
        /// \param version 版本字符串，长度限制为255个字符
        /// \return 若成功，返回true；若失败，返回false
        static bool SaveFamilyFileVersion(const std::wstring &filePathName, const std::wstring &version);
    };
}// namespace gfam

